﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Biz.UserManagement;

namespace Web
{
    public class PageHelper : System.Web.UI.Page
    {
        protected Employee CurrentUser
        {
            get
            {
                if (Session["CurrentUser"] == null)
                {
                    string domainInfo = System.Web.HttpContext.Current.User.Identity.Name;
                    string id = string.Empty;
                    string domain = string.Empty;
                    //去除域信息
                    if (domainInfo.IndexOf("\\") > 0)
                    {
                        id = domainInfo.Substring(domainInfo.IndexOf("\\") + 1);
                        domain = domainInfo.Substring(0, domainInfo.IndexOf("\\"));
                    }
                    if (domainInfo.IndexOf("@") > 0)
                    {
                        id = domainInfo.Substring(0, domainInfo.IndexOf("@"));
                        domain = domainInfo.Substring(domainInfo.IndexOf("@") + 1);
                    }
                    if (domain != "MZHDEV-8CBD1DAA")
                        return null;
                    //Session["CurrentUser"] = Employee.GetEmployee(domainInfo);
                    Session["CurrentUser"] = new Employee();
                }
                return (Employee)Session["CurrentUser"];
            }
        }
    }
}